import request from '@/utils/request'
import Qs from 'qs'

export default {
  /* 系统角色列表 */
  sysRoleList: function({ pageNo, pageSize}){
    return request({
      method: 'GET',
      url: '/sys/role/roleList',
      params: {
        pageNo: pageNo,
        pageSize: pageSize
      }
    })
  },
	/* 系统角色详情 */
	sysRoleDetail: function(id){
	  return request({
	    method: 'GET',
	    url: '/sys/role/'+id
	  })
	},
	/* 新增系统角色 */
	addRole: function({name, menuIds}){
	  return request({
	    method: 'POST',
	    url: '/sys/role/addRole',
	    data: Qs.stringify({
	      name: name,
				menuIds: menuIds
	    })
	  })
	},
	/* 更新系统角色 */
	updateRole: function({id, name, menuIds}){
	  return request({
	    method: 'POST',
	    url: '/sys/role/updateRole',
	    data: Qs.stringify({
	      roleId: id,
	      name: name,
	      menuIds: menuIds
	    })
	  })
	}
}
